package today.rocky.boot.druid.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import today.rocky.boot.druid.service.SysUserService;

/**
 * @author Rocky
 * @date 2020/2/7 15:30
 */
@RestController
public class S2Controller {
    @Autowired
    private SysUserService userService;

    @RequestMapping("s2")
    public String s1(){
        return "redirect:http://localhost:8082/s2";
    }

    @RequestMapping("/dataSourceCheck")
    public String s2(Integer id){
        if(id.equals(1)){
            return userService.findUserByFirstDb(1).toString();
        }else {
            return userService.findUserBySecondDb(2).toString();
        }

    }

}
